local hx__chunqiu = fk.CreateSkill{
  name = "hx__chunqiu",
  tags = { Skill.Compulsory },
}

local U = require "packages/utility/utility"

hx__chunqiu:addEffect("active", {
  anim_type = "control",
  card_num = 999,
  target_num = 0,
  expand_pile = function(self, player)
    local ids = {}
    for i = 1, player.maxHp, 1 do
      if i > #Fk:currentRoom().draw_pile then break end
      table.insert(ids, Fk:currentRoom().draw_pile[i])
    end
    return ids
  end,
  card_filter = Util.FalseFunc,
  can_use = Util.TrueFunc,
})

hx__chunqiu:addEffect(fk.AfterCardsMove, {
  mute = true,
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and player.room.current ~= player and player:getMark("hx__chunqiu_mute-turn") == 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:viewCards(player, {
      cards = room:getNCards(player.maxHp),
      skill_name = self.name,
    })
    local choice = room:askToChoice(player, {
      choices = {"本回合不再显示", "Cancel"},
      skill_name = self.name,
    })
    if choice == "本回合不再显示" then
      room:addPlayerMark(player, "hx__chunqiu_mute-turn")
    elseif choice == "Cancel" then
      return false
    end
  end,
})
--[[
hx__chunqiu:addEffect(fk.AfterSkillEffect, {
  mute = true,
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and player.room.current ~= player and player:getMark("hx__chunqiu_mute-turn") == 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    U.viewCards(player, room:getNCards(player.maxHp), self.name)
    local choice = room:askToChoice(player, {
      choices = {"本回合不再显示", "Cancel"},
      skill_name = self.name,
    })
    if choice == "本回合不再显示" then
      room:addPlayerMark(player, "hx__chunqiu_mute-turn")
    elseif choice == "Cancel" then
      return false
    end
  end,
})
--]]

return hx__chunqiu
